home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / netprog.zip / NETPROG.TAR / lib / sigchild.c < prev    next >
C/C++ Source or Header  |  1989-12-17  |  602b  |  29 lines

  1. /*
  2.  * This is a 4.3BSD SIGCLD signal handler that can be used by a
  3.  * server that's not interested in its child's exit status, but needs to
  4.  * wait for them, to avoid clogging up the system with zombies.
  5.  *
  6.  * Beware that the calling process may get an interrupted system call
  7.  * when we return, so they had better handle that.
  8.  */
  9.  
  10. #include    "systype.h"
  11.  
  12. #include    <sys/wait.h>
  13. #include    <signal.h>
  14.  
  15. sig_child()
  16. {
  17. #ifdef    BSD
  18.     /*
  19.      * Use the wait3() system call with the WNOHANG option.
  20.      */
  21.  
  22.     int        pid;
  23.     union wait    status;
  24.  
  25.     while ( (pid = wait3(&status, WNOHANG, (struct rusage *) 0)) > 0)
  26.         ;
  27. #endif
  28. }
  29.